'''
Created on 18 dec. 2011

@author: Daan
'''
from abc import abstractmethod

class Road(object):
    '''
    classdocs
    '''
    
    width = 19

    def __init__(self, lanes, x, y, length, opposite, name):
        '''
        Constructor
        '''
        self._lanes = lanes
        self._x = x
        self._y = y
        self._l = length
        self._opposite = opposite
        
        self._name = name
        
        self._lengths = []
        for x in range(lanes): self._lengths.append(None)
    
    @classmethod
    def CalcHeight(cls, lanes):
        return cls.width * lanes
    
    def __str__(self):
        return self._name
        
    def __repr__(self):
        return self.__str__()
    
    def GetName(self):
        return self.__str__()
    
    def AddLength(self, lane, length):
        self._lengths[lane] = length
    
    def GetLength(self, lane):
        return self._lengths[lane-1]
    
    @abstractmethod
    def GetX(self):
        raise NotImplementedError()
    
    @abstractmethod
    def GetY(self):
        raise NotImplementedError()
    
    @abstractmethod
    def GetL(self):
        raise NotImplementedError()
    
    @abstractmethod
    def GetXYInLane(self, lane, offset, canvas=None):
        raise NotImplementedError()
    
    @abstractmethod
    def GetLaneCenter(self, lane, offset):
        raise NotImplementedError()
    
    @abstractmethod    
    def Draw(self, canvas):
        raise NotImplementedError()
            
